<?php

class Application_Model_DbTable_Messages extends Zend_Db_Table_Abstract {

    protected $_name = 'messages';
	
    public function getMessage($text,$robotId){
        $row = $this->fetchRow("text='".$text."' AND robotId =  '".$robotId."'");
        return $row;
	}
	
    public function getMessages($robotId){
        $row = $this->fetchAll("robotId = ".$robotId);
        return $row;
	}
	
	public function createMessage($ask,$robotId){
		$row = $this->createRow();
		$row->text = $ask;
		$row->robotId = $robotId;
		$row->save();
		return $row;
	}
}
